// components/marquee/marquee.js
var index = 0
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    text: {
      type: String,
      value: '正在加载公告内容...',
      observer: function (newVal, oldVal) {
        let that = this
        let marqueeWidth = 0
        let textWidth = 0
        let containerWidth = 0
        let duration = 0
        that.createSelectorQuery().select('.marquee_text').boundingClientRect(function (res) {
          textWidth = res.width

          that.createSelectorQuery().select('.marquee_container').boundingClientRect(function (res) {
            containerWidth = res.width

            marqueeWidth = textWidth - containerWidth
            duration = textWidth * 10
       //     console.log(textWidth, containerWidth, marqueeWidth, duration)


            // animation.translateX(-marqueeWidth).step()
            that.setData({
              textWidth,
              duration,
              marqueeWidth,

            })
          }).exec()


        }).exec()


      }
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {

    animationiteration(e) {
     // console.log("animationiteration", e);

    },
    animationend(e) {
     // console.log("animationend", e);

    },

  },

})